package com.zzyl.controller;

import com.zzyl.base.ResponseResult;
import com.zzyl.dto.NursingLevelDto;
import com.zzyl.service.NursingLevelService;
import com.zzyl.vo.NursingLevelVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Description NursingLevel
 * @Author lifuyun
 * @Date 2024-08-28
 */
@RestController
@RequestMapping("/nursingLevel")
@Slf4j
@Api(tags = "护理等级管理")
public class NursingLevelController extends BaseController {
    @Autowired
    private NursingLevelService nursingLevelService;

    /**
     * 查询所有护理等级
     *
     * @return
     */
    @GetMapping("/listAll")
    @ApiOperation("查询所有护理等级")
    public ResponseResult<List<NursingLevelVo>> getAllNursingLevel() {
        log.info("处理查询所有护理等级的请求");
        List<NursingLevelVo> list = nursingLevelService.getAllNursingLevel();
        return success(list);
    }

    /**
     * 新增护理等级
     * @return
     */
    @PostMapping("/insert")
    @ApiOperation("新增护理等级")
    @ApiImplicitParam(name = "nursingLevelDto", value = "护理等级数据传输对象", required = true)
    public ResponseResult addNursingLevel(@RequestBody NursingLevelDto nursingLevelDto){
        log.info("处理新增护理等级的请求,请求参数：{}",nursingLevelDto);
        nursingLevelService.addNursingLevel(nursingLevelDto);

        return success();
    }
}
